var t = getApp();

Page({
    data: {
        month_arr: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ],
        time_show: !1,
        time_text: "",
        current_year: "",
        current_month: "",
        max_year: "",
        max_month: "",
        person: {},
        info_list: [],
        picture_list: [],
        video_list: [],
        pic_src_list: []
    },
    onLoad: function(t) {
        var e = new Date();
        this.setData({
            current_year: e.getFullYear(),
            max_year: e.getFullYear(),
            current_month: e.getMonth() + 1,
            max_month: e.getMonth() + 1
        }), this.getData();
    },
    onReady: function() {},
    handImagePreview: function(t) {
        var e = t.currentTarget.dataset.src;
        wx.previewImage({
            urls: [ e ]
        });
    },
    getData: function() {
        var e = this, a = {
            id: this.options.id
        };
        "" != this.data.time_text && (a.time = this.data.time_text);
        var r = t.getNetAddresss("plugin.present-project.frontend.project.personDetail");
        t._getNetWork({
            url: r,
            data: a,
            success: function(a) {
                var r = a.data;
                if (1 != r.result) return t.tips(r.msg);
                var n = [], i = [], o = [], s = [];
                r.data.person_list.forEach(function(t) {
                    if (n.length < 5) {
                        var e = "";
                        t.project_v && t.project_v.title && (e = t.project_v.title);
                        var a = {
                            id: t.id,
                            price: t.price,
                            remarks: t.remarks,
                            project_title: e
                        };
                        n.push(a);
                    }
                    i.length < 10 && t.change_img.forEach(function(e) {
                        if (10 != i.length) {
                            var a = "";
                            t.project_v && t.project_v.title && (a = t.project_v.title);
                            var r = {
                                name: a,
                                url: e
                            };
                            i.push(r), s.push(e);
                        }
                    }), o.length < 10 && t.change_video.forEach(function(e) {
                        if (10 != o.length) {
                            var a = "";
                            t.project_v && t.project_v.title && (a = t.project_v.title);
                            var r = {
                                name: a,
                                url: e
                            };
                            o.push(r);
                        }
                    });
                }), e.setData({
                    person: r.data.person,
                    info_list: n,
                    picture_list: i,
                    video_list: o,
                    pic_src_list: s
                });
            }
        });
    },
    changeYear: function(t) {
        var e = t.currentTarget.dataset.type;
        if ("add" == e) {
            if (this.data.current_year < this.data.max_year) {
                var a = ++this.data.current_year;
                this.setData({
                    current_year: a
                }), this.data.current_year == this.data.max_year && this.setData({
                    current_month: this.data.max_month
                });
            }
        } else if ("recude" == e) {
            var r = --this.data.current_year;
            this.data.current_year > 1 && this.setData({
                current_year: r
            });
        }
    },
    changeMonth: function(t) {
        var e = t.currentTarget.dataset.item;
        this.data.current_year >= this.data.max_year ? e <= this.data.max_month && this.setData({
            current_month: e
        }) : this.setData({
            current_month: e
        });
    },
    timeConfirm: function() {
        this.setData({
            time_show: !1,
            time_text: this.data.current_year + "-" + this.data.current_month
        }), this.getData();
    },
    gotoPage: function(t) {
        var e = t.currentTarget.dataset.name, a = "/packageI/donation_project/".concat(e, "/").concat(e, "?id=").concat(this.options.id);
        "" != this.data.time_text && (a += "&time=".concat(this.data.time_text)), wx.navigateTo({
            url: a
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    setTimeShow: function() {
        this.setData({
            time_show: !this.data.time_show
        });
    },
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});